package com.wcgksoft.service.system;

import com.wcgksoft.common.base.BaseService;
import com.wcgksoft.entity.system.SysUser;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 阿良
 * @version 1.0.0
 * @ClassName UserService.java
 * @Description TODO
 * @createTime 2020年03月05日 15:44:00
 */
@Service
public class UserService extends BaseService<SysUser> {


  public SysUser loginSysUser(String user ,String pwd){
    DetachedCriteria criteria = DetachedCriteria.forClass(SysUser.class);
    criteria.add(Restrictions.and(Restrictions.eq("passWord",pwd),Restrictions.eq("phone",user)));
    List<SysUser> sysUsers = this.findByConditions(criteria);
    if (sysUsers.size()>0){
      return sysUsers.get(0);
    }else{
      return null;
    }

  }
}
